<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>后台登录-L-admin2.0</title>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
		<meta http-equiv="Cache-Control" content="no-siteapp" />

		<link rel="shortcut icon" href="images/titlelogo.png" type="image/x-icon" />
		<link rel="stylesheet" href="css/font.css" charset="utf-8">
		<link rel="stylesheet" href="css/xadmin.css" charset="utf-8">

		<link rel="stylesheet" href="css/layuiadmin.css" />



		<script src="js/jquery-3.3.1.min.js"></script>
		<script src="layui2/src/layui.js"></script>
		
		<script type="text/javascript" src="js/xadmin.js" charset="utf-8"></script>


	</head>
	<style>
		cite{
			/* color: red; */
			font-size: 16px;
		}
	</style>
	<script type="text/javascript">
		var WebSocketUrl = 'ws://localhost:6086?type=ConnetSocket';
		var UpdateHeart = true;
		var MyLoop = null;
		var isConnectSocket = {
			state: false,
			loop: null
		};
		var ws = null;
		count = 0;

		$(function() {
			$(".layui-badge").empty();
			$('.layui-badge').attr("style", "display:none;")


			$("#dian").click(function() {
				$(".layui-badge").empty();
				count = 0;
				$('.layui-badge').attr("style", "display:none;")
				// alert(count)
			})
		})

		function HeartBeart() {
			loop();

			function loop() {
				console.log('心跳包发送1');
				MyLoop = setTimeout(loop, '4000');


				if (!UpdateHeart) {
					clearTimeout(MyLoop);
					// console.log('socket似乎断线了,停止心跳检测');
					UpdateHeart = true;


					// var open=confirm("网络好像断开1，请重新连接网络");
					if (open) {
						loopconnect();

						function loopconnect() {

							isConnectSocket.state = true;
							isConnectSocket.loop = setTimeout(loopconnect, '7000');
							ConnectSocket();

						}


					} else {

					}

					// this_.$options.methods.SetTipsFn.call(this_, "系统提示", '通信断开，重新连接！', 'CutSocket', false, null)
					//                      this_.$options.methods.ConnectSocket.call(this_);
				} else {
					// console.log('心跳检测');
					ws.send(JSON.stringify({
						type: 'HeartBeat'
					}));
					UpdateHeart = false;
					// alert("连接网络成功");
				}


			}


		}
		ConnectSocket();
		var idd = "";
		cout = 0;

		function ConnectSocket() {
			ws = new WebSocket(WebSocketUrl);
			ws.onopen = function() {
				// console.log('websocket打开');
				ws.send(JSON.stringify({
					type: 'MyInfo',
					id: "-1"
				}));
			};
			ws.onmessage = function(ev) {

				var mydata = JSON.parse(ev.data);
				console.log("pp:", mydata, " ", ev);
				if (mydata.type == "ConnetSuccess") {
					console.log('success socket');

					if (isConnectSocket.state) {
						console.log('is null');
						clearTimeout(isConnectSocket.loop);
						isConnectSocket.state = false;
					}

					console.log('is not null');
					HeartBeart();

				}

				if (mydata.type == 'UpdateSuccess') {
					UpdateHeart = true;
					console.log('socket心跳更新成功！');
				}


				if (mydata.type == 'NewOrder_i') {

					// cx()
					$(".layui-badge").empty();
					$(".layui-badge").show();
					console.log("-----------")
					// $("#ordre1").addClass('layui-this').siblings('li').removeClass('layui-this');
					count++;
					$(".layui-badge").append(count)
					idd = mydata.id;
					var arr_idd = idd.split(",");
					// ko(parseInt(arr_idd[1]))
					cout++;
					// console.log('有新的报修订单,请触发提示信息，或重新获取信息'," ",cout," ", arr_idd[1]," = ",typeof(arr_idd[1]));
				}

				if (mydata.type == "NewOrder_Success") {
					console.log("dsfqqqqq");
				}
			};
			ws.onclose = function(ev) {
				// console.log('socket关闭');
			};
			ws.onerror = function(ev) {
				// console.log('socket错误');
				console.log(ev);
			};

		}
	</script>
	<body>
		<!-- 顶部开始 -->
		<div class="container">
			<div class="logo"><a href="index.html">预约系统管理</a></div>
			<div class="left_open">
				<i title="展开左侧栏" class="iconfont"><img src="images/left.png" width="16px" height="16px" /></i>
			</div>

			<ul class="layui-nav right" lay-filter="">
				<li class="layui-nav-item">
					<a href="javascript:;">
						<script>
							document.write(localStorage.getItem('xops_id'))
						</script>
					</a>
					<dl class="layui-nav-child">
						<!-- 二级菜单 -->
			<!-- 			<dd><a onclick="x_admin_show('个人信息',''>个人信息</a></dd>
              <dd><a onclick=" x_admin_show('切换帐号',''>切换帐号</a></dd> -->
						<dd><a href="login.html">退出</a></dd>
					</dl>
				</li>

			</ul>

		</div>
		<!-- 顶部结束 -->
		<!-- 中部开始 -->
		<!-- 左侧菜单开始 -->
		<div class="left-nav">
			<div id="side-nav">
				<ul id="nav">
					<li id="order1">
						<!-- <a href="javascript:;"> -->
						<!-- <i class="iconfont">&#xe6eb;</i> -->
					<li id="dian"><a _href="manage2.html"><i class="iconfont">&#xe6a7;</i><cite>我的预约 &nbsp;&nbsp;<span class="layui-badge"
								 style="display: none;"></span></cite></a></li>
					<!-- <i class="iconfont nav_right">&#xe6a7;</i> -->
					<!-- </a> -->
					<!-- <ul class="sub-menu">
                    <li><a _href="manage2.html"><i class="iconfont">&#xe6a7;</i><cite>我的订单  &nbsp;&nbsp;<span class="layui-badge">9</span></cite></a></li >
                </ul> -->
					</li>
					

					<li>
						<a href="javascript:;">
							<i class="iconfont">&#xe6eb;</i>
							<cite>设置管理</cite>
							<i class="iconfont nav_right">&#xe6a7;</i>
						</a>
						<ul class="sub-menu">
							<li>
								<a _href="baoxiu.html?id=211&account=admin" id="yu1" target="page-content">
									<i class="iconfont">&#xe6a7;</i>
									<cite>预约设置</cite>
								</a>
							</li>
							<li><a _href="html/time.html"><i class="iconfont">&#xe6a7;</i><cite>时间设置</cite></a></li>
							 <li>
								<a href="javascript:;">
									<i class="iconfont">&#xe6b8;</i>
									<cite>人员管理</cite>
									<i class="iconfont nav_right">&#xe6a7;</i>
								</a>
								<ul class="sub-menu">
							<li>
								<a _href="user.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>用户管理</cite>
							
								</a>
							</li>
							<li>
								<a _href="teacher.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>职工管理</cite>
							
								</a>
							</li>
							<li>
								<a _href="teacher.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>管理员管理</cite>
							
								</a>
							</li>
							</ul>
							</li>
						</ul>
						
					</li>
					<li>
						<a href="javascript:;">
							<i class="iconfont">&#xe69e;</i>
							<cite>课表管理</cite>
							<i class="iconfont nav_right">&#xe6a7;</i>
						</a>
						<ul class="sub-menu">
							<li>
								<a _href="class.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>课室课程表</cite>
								</a>
							</li>
							

							<li>
								<a _href="schedule.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>班级课程表</cite>
								</a>
							</li>

						
						</ul>
					</li>
					

					<!-- <li>
						<a href="javascript:;">
							<i class="iconfont">&#xe6b8;</i>
							<cite>人员管理</cite>
							<i class="iconfont nav_right">&#xe6a7;</i>
						</a>
						<ul class="sub-menu">
							<li>
								<a _href="user.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>用户管理</cite>

								</a>
							</li>
							<li>
								<a _href="teacher.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>职工管理</cite>

								</a>
							</li>
							<li>
								<a _href="teacher.html">
									<i class="iconfont">&#xe6a7;</i>
									<cite>管理员管理</cite>

								</a>
							</li>

						</ul>
					</li> -->
					<li>
						<a href="javascript:;">
							<i class="iconfont">&#xe6ae;</i>
							<cite>系统统计</cite>
							<i class="iconfont nav_right">&#xe6a7;</i>
						</a>
						 <ul class="sub-menu">
						                <li>
						                    <a _href="html/echarts1.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>拆d</cite>
						                    </a>
						                </li >
						               <!-- <li>
						                    <a _href="html/echarts2.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>柱状图</cite>
						                    </a>
						                </li>
						                <li>
						                    <a _href="html/echarts3.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>地图</cite>
						                    </a>
						                </li>
						                <li>
						                    <a _href="html/echarts4.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>饼图</cite>
						                    </a>
						                </li>
						                <li>
						                    <a _href="html/echarts5.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>雷达图</cite>
						                    </a>
						                </li>
						                <li>
						                    <a _href="html/echarts6.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>k线图</cite>
						                    </a>
						                </li>
						                <li>
						                    <a _href="html/echarts7.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>热力图</cite>
						                    </a>
						                </li>
						                <li>
						                    <a _href="html/echarts8.html">
						                        <i class="iconfont nav_right"><img src="images/right.png" width="18px" height="18px" /></i>
						                        <cite>仪表图</cite>
						                    </a>
						                </li> -->
						            </ul>
						        </li>            </ul>
						  </div>
						</div>

		<!-- <div class="x-slide_left"></div> -->
		<!-- 左侧菜单结束 -->
		<!-- 右侧主体开始 -->
		<div class="page-content">
			<div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
				<ul class="layui-tab-title">
					<li class="home"><i class="layui-icon"><img src="images/zhuye.png" height="22px" width="20px" /></i>我的主页<img src="images/cha.png"
						 width="16px" height="16px" /></li>
				</ul>

				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show">
						<iframe src="html/welcome.html" frameborder="0" scrolling="yes" class="x-iframe"></iframe>

					</div>

				</div>


			</div>
		</div>




		<script>
			// $(function(){
			// 
			// 	var hf="baoxiu.html?id=211&account=admin";
			// 	$("#yu1").attr("href",hf);
			// 	
			// })
			// console.log("[]"+localStorage.getItem('xops_id'));
		</script>
		<!-- <div class="page-content-bg"></div> -->
		<!-- 右侧主体结束 -->
		<!-- 中部结束 -->
		<!-- 底部开始 -->
		<!--<div class="footer">
        <div class="copyright">Copyright ©2019 L-admin v2.3 All Rights Reserved</div>  
    </div>-->
		<!-- 底部结束 -->

	</body>
</html>
